const formatTime = date => {
  const time = new Date(date)
  const year = time.getFullYear()
  const month = time.getMonth() + 1
  const day = time.getDate()
  const hour = time.getHours()
  const minute = time.getMinutes()
  const second = time.getSeconds()

  return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : '0' + n
}
function screenInfo () {
   wx.getSystemInfo({
     success(res) {
       console.log(res.model)
       console.log(res.pixelRatio)
       console.log(res.windowWidth)
       console.log(res.windowHeight)
       console.log(res.language)
       console.log(res.version)
       console.log(res.platform)
     }
   })
 }
module.exports = {
  formatTime: formatTime,
  screenInfo: screenInfo
}
